/*
 * ANSI definitions for GNU cc.
 * [atw] 19-Sep-89.
 */

#ifndef STDDEF_H
#define STDDEF_H

#ifdef __STRICT_ANSI__
    /* "compiled with -ansi" switch */
#   define TYPEOF __typeof__
#else
#   define TYPEOF typeof
#endif

/*
 * ptrdiff_t : "the signed integral type of the result of subtracting two pointers."
 */

#ifdef __STDC__
    typedef TYPEOF((void *)1-(void *)0) ptrdiff_t;
#else
    /* compiled with "-traditional" switch */
    typedef int ptrdiff_t;
#endif

/*
 * size_t : "the unsigned integral type of the result of the sizeof operator."
 */

#ifndef _SIZE_T
#define _SIZE_T
#ifdef __STDC__
    typedef TYPEOF(sizeof(0)) size_t;
#else
    /* compiled with "-traditional" switch */
    typedef unsigned size_t;
#endif
#endif

/*
 * NULL : null pointer constant.
 */
#ifndef NULL
#define NULL         ((void *)0)
#endif

/*
 * offsetof(type, identifier) : "offset in bytes from identifier to the beginning
 *                               of its structure (type)."
 */
#define offsetof(type,id) ((size_t)&(((type *)0)->id))

/*
 * wchar_t : 
 */
#ifndef _WCHART
#define _WCHART
typedef unsigned short  _Wchart;
typedef _Wchart wchar_t;
#endif

#endif